import {
  SET_VIP_INFO,
} from '../types'

import Vue from 'vue'
import {
  getVipInfo
} from '@/api/vip'

export default {
  state: {
    vipInfo: null,
  },
  mutations: {
    [SET_VIP_INFO](state, vipInfo) {
      state.vipInfo = vipInfo;
    },
  },
  actions: {
    async getVipInfo({ commit }) {
      Vue.prototype.$loading();
      const { data, code } = await getVipInfo();
      Vue.prototype.$loading.close();
      commit('SET_VIP_INFO', data);
      return code == 200;
    }
  }
};